package com.jerkin.jieba;

import com.huaban.analysis.jieba.JiebaSegmenter;
import com.huaban.analysis.jieba.SegToken;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @className:JiebaHelper
 * @author:huhongzhi
 * @createTime:2021/3/15 11:15
 * @version:1.0
 */
public class JiebaHelper {


    public static String segemet(String value) {
        JiebaSegmenter segmenter = new JiebaSegmenter();
        List<SegToken> list = segmenter.process(value,JiebaSegmenter.SegMode.SEARCH);
        List<String> result = new ArrayList<>(list.size());
        for(SegToken segToken:list){
            result.add(segToken.word);
        }
        return StringUtils.join(result);
    }
}